package org.sjs.dreamfly.biz.movie

object MovieConstants {
    const val CHANNEL_TYPE_DIANSHIJU = "dianshiju"
    const val CHANNEL_TYPE_DIANYING = "dianying"
    const val CHANNEL_TYPE_JILUPIAN = "jilupian"
    const val CHANNEL_TYPE_SHAOER = "shaoer"
    const val CHANNEL_TYPE_DONGMAN = "dongman"
    const val CHANNEL_TYPE_ZONGYI = "zongyi"
    const val CHANNEL_TYPE_OTHER_CHIHUAYU = "chihuayu" // 影视大全
    private const val CHANNEL_ID_DIANSHIJU = 94349541317
    private const val CHANNEL_NAME_DIANYING = 94349541312
    private const val CHANNEL_NAME_JILUPIAN = 94349541547
    private const val CHANNEL_NAME_SHAOER = 94349541392
    private const val CHANNEL_NAME_DONGMAN = 94349541407
    private const val CHANNEL_NAME_ZONGYI = 94349541327


    fun getChannelId(channelType: String): Long {
        return when (channelType) {
            CHANNEL_TYPE_DIANYING -> CHANNEL_NAME_DIANYING
            else -> CHANNEL_ID_DIANSHIJU
        }
    }

    fun getXiGuaChannelHomePageUrl(channelPinyin: String): String {
        return "https://www.ixigua.com/channel/$channelPinyin"
    }
    fun getXiGuaChannelFilterPageUrl(channelPinyin: String): String {
        return "https://www.ixigua.com/stream/cinema/filter/$channelPinyin"
    }

    fun jsCodeForXiGuaMovieLoadMore(url: String) =
        "function httpRequest() {" +
        "    fetch('$url')" +
        "        .then(response => response.json())" +
        "        .then(data => {" +
        "            var result = {" +
        "               location:document.location," +
        "               data: data" +
        "            };" +
        "            var params = JSON.stringify(result);" +
        "            window.JsBridge.callNative('onMovieListLoaded', params);" +
        "        })\n" +
        "        .catch(error => {" +
        "            console.log(error);" +
        "        }" +
        "        );" +
        "}" +
        "httpRequest();"
}

//"" +